package com.horatio.Thread;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * 线程池管理器
 * @author hongxiao.z
 * @date   2014-5-20  下午3:52:36
 */
public class ThreadPoolManager {
	
	private static final class SingletonHolder
	{
		private static final ThreadPoolManager	INSTANCE	= new ThreadPoolManager();
	}
	
	
	public static ThreadPoolManager getInstance()
	{
		return SingletonHolder.INSTANCE;
	}
	
	private static Logger log = LoggerFactory.getLogger(ThreadPoolManager.class);
	
	/**
	 * 最大延迟时间
	 */
	private final static long MAX_DELAY = TimeUnit.NANOSECONDS.toMillis(Long.MAX_VALUE - System.nanoTime()) / 2;
	
	/**
	 * 执行AI线程池
	 */
	private final ScheduledThreadPoolExecutor actionPool;
	
	private ThreadPoolManager()
	{
		actionPool = new ScheduledThreadPoolExecutor(1, new PriorityThreadFactory("ScheduledPool", Thread.NORM_PRIORITY));
	}
}
